package com.dongbing.demo.modules.system.service;

import com.dongbing.demo.modules.system.mapper.RePassMapper;
import com.dongbing.demo.modules.system.utils.SecurityUtils;
import org.apache.catalina.security.SecurityUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dongbing.demo.modules.system.entity.UserInfo;
import java.security.Security;
import java.util.HashMap;
import java.util.List;


@Service
public class RePasswod {
    @Autowired
    RePassMapper rePassMapper;
  public String RePasswod(String name ,String edPassd) {
      List<UserInfo> cc = rePassMapper.findpassd(name);
      if (cc.size() == 1) {
          HashMap<String, String> myMap1 = new HashMap<String, String>();
          for (UserInfo keys : cc) {
//            String ss= SecurityUtils.encryptPassword(keys.getPassword());
              System.out.println(keys.getPassword());
              if (SecurityUtils.matchesPassword(keys.getPassword(), edPassd)) {
                  return keys.getPassword();
              } else {
                  return "false";
              }
          }


          System.out.println(cc);
          return "cc";
      }

      return "cc";
  }

}

